
//LatLng    = Packages.com.google.maps.LatLng;
//Map = Packages.com.google.maps.Map;
function main( pp, hh ) {
    
  var j = pp.getQueryParameters().getFirst("json");
  var json = new JSONObject(j);
  var address = json.get('ADDRESS').replace(" ","+");
  var url = new java.net.URL("http://maps.googleapis.com/maps/api/geocode/json?address=" + 
                             address + "&sensor=false");
    
    var u = url.openConnection();
   var inB = new java.io.BufferedReader( new java.io.InputStreamReader(u.getInputStream()));
    var inputLine;    
    var result = "";
 
  while ((inputLine = inB.readLine()) != null) 
        result += " " + inputLine;

    inB.close();         
    
//return result;  
  var json = new JSONObject(result);
  return json;

}